Skip to content

Conversation

@inteon
Copy link
Contributor

@inteon inteon commented Jun 10, 2025

  • Removed PostDataReadings function from the client interface, since PostDataReadingsWithOptions can be used instead.
  • Removed Post function from the client interface, since it was not used (config.OrganizationID cannot be "")

Signed-off-by: Tim Ramlot <[email protected]>
return nil
}

if config.OrganizationID == "" {
Copy link
Contributor Author

@inteon inteon Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not be true when TLSPKMode is JetstackSecureOAuth or JetstackSecureAPIToken, since this is checked here:

if cfg.OrganizationID == "" {
errs = multierror.Append(errs, fmt.Errorf("organization_id is required"))
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the other two modes (VenafiCloudKeypair and VenafiCloudVenafiConnection are handled above already).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine that the test coverage would show that this code path is never run? Either way, this doesn't seem to be tested anyways. I'm fine with removing this.

@inteon inteon force-pushed the cleanup_part2 branch 2 times, most recently from 5539c6e to 6312622 Compare June 10, 2025 12:47
@inteon inteon requested a review from Copilot June 10, 2025 12:47

This comment was marked as outdated.

@inteon inteon requested review from Copilot, maelvls and wallrj June 10, 2025 12:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Cleans up the client interface by removing unused methods, consolidating HTTP helpers, and updating the agent’s data-posting logic.

  • Flattened repeated failure checks in the mock identity server.
  • Dropped PostDataReadings/Post from the client interface and renamed helpers to unexported methods (postDataReadings, post).
  • Refactored postData in the agent to use a switch on TLSPKMode and always call PostDataReadingsWithOptions.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/internal/cyberark/identity/mock.go Combined multiple if blocks into a single OR-based check in handleAdvanceAuthentication.
pkg/client/client_venconn.go Removed unused PostDataReadings and Post methods from VenConnClient.
pkg/client/client_venafi_cloud.go Swapped exported Post calls to unexported post and merged reading uploads into one call.
pkg/client/client_oauth.go Renamed PostDataReadings and Post to unexported helpers for consistency.
pkg/client/client_api_token.go Same renaming of public helpers to unexported methods.
pkg/client/client.go Deleted PostDataReadings and Post from the Client interface.
pkg/agent/run.go Rewrote postData to switch on TLSPKMode and route through PostDataReadingsWithOptions.
Comments suppressed due to low confidence (3)

pkg/client/client_venafi_cloud.go:226

  • Update this comment to reference post (the new method name) instead of Post to keep docs in sync with the code.
// Post performs an HTTP POST request.

pkg/client/client_api_token.go:86

  • The method was renamed to post, so this doc comment should be updated to avoid confusion.
// Post performs an HTTP POST request.

pkg/agent/run.go:453

  • Add a unit or integration test for the default TLSPKMode branch to verify that it returns the expected "not implemented" error.
default:

Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I find the new code easier to understand.

/approve
/lgtm

@inteon inteon merged commit 5476b9d into master Jun 11, 2025
2 checks passed
@wallrj wallrj deleted the cleanup_part2 branch June 11, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants